<template>
  <Spin :spinning="loading" tip="Loading...">
    <div>
      <!--    <BreakSpace label="" :containerStyle="{ marginBottom: '10px' }" />-->
      <FormPanel ref="formPanel1" :list="formList1" :cols="3" labelWidth="100" :isSubmitBtn="false" @formChange="formChangeHandle" />
      <div style="padding-top: 3rem;"></div>
      <BaseDialog :visible.sync="selectDelearFlag" :title="dialogTitle" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
        <DealerList @close="Delearclose" @save="Delearsave" selectionType="single"/>
      </BaseDialog>
      <Drawer :visible.sync="visibleEdit" :title="'索赔查看'" destroyOnClose width="100%" :containerStyle="{ height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px' }">
        <editForm @close="editclose" @save="editsave" :rowData="rowData"></editForm>
      </Drawer>
      <BaseDialog :visible.sync="selectClaim" :title="'紧急返件选择'" destroyOnClose :containerStyle="{height: 'calc(100% - 60px)', overflow: 'auto', paddingBottom: '60px'}">
        <SelectClaim @close="claimClose" @save="claimSave" :ownerCode="ownerCode"></SelectClaim>
      </BaseDialog>

      <BreakSpace label="紧急返件列表" :containerStyle="{ marginBottom: '10px' }" />
      <FilterTable
        ref="table1"
        :columns="columns"
        :params="fetchParams"
        :dataSource="dataList"
        :datakey="'items'"
        :onColumnsChange="columns => (this.columns = columns)"
        :onRowSelectChange="selectChange"
        selectionType="single"
        height="auto"
        :isPagination=false
        :isSelectColumn=false
      >
<!--        <template slot="controls" slot-scope="props">-->
<!--          <multiuse-button size="small" type="primary" icon="el-icon-plus" @click="claimSelect()">新增</multiuse-button>-->
<!--        </template>-->
      </FilterTable>
      <div style="padding-top: 3rem;"></div>
      <BreakSpace label="审核说明" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel ref="formPanel3" :list="auditInfoColumns" :cols="3" labelWidth="100" :isSubmitBtn="false" @formChange="formChangeHandle2" />
      <div style="padding-top: 3rem;"></div>
          <BreakSpace label="操作记录" :containerStyle="{ marginBottom: '10px' }" />
          <FilterTable
            ref="table2"
            :columns="caozuojilucolumns"
            :params="fetchParams"
            :dataSource="dataList1"
            :datakey="'items'"
            :onColumnsChange="columns => (this.columns = columns)"
            :onRowSelectChange="selectChange"
            selectionType="single"
            height="auto"
            :isPagination=false
            :isSelectColumn=false
          >
          </FilterTable>
      <div style="margin-bottom: 1rem;"></div>
      <div style="padding-top: 3rem;"></div>
      <div
        :style="{
        position: 'fixed',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
      >
<!--        <multiuse-button type="primary" :click="save.bind()">保 存</multiuse-button>-->
<!--        <multiuse-button type="primary" :click="warehousing.bind()">上 报</multiuse-button>-->
        <multiuse-button @click="closeDialog">关 闭</multiuse-button>
      </div>
    </div>
  </Spin>
</template>
<script>
import editForm from '@/pages/claimDemage/BasicData/ClaimQueryFactory/editForm.vue'
import {getPartType, getByPermissionCtrl, getListByExampleWhere} from '@/api/dictionary/index.js';
import {editSave ,selectById, findFileByUrl} from '@/api/usedPartsReturnManage/usedPartsReturn_OEM/usedPartsWarehousing';
import { dictionary } from '@/utils/dictMixin';
import {
  checkCertificateNo, getPartListByClaimId, jfSaveAdd, selectDetail
} from '@/api/usedPartsReturnManage/usedPartsReturn_OEM/usedPartsJF';
import SelectClaim from './SelectClaim.vue';
import DealerList from '@/pages/claimDemage/tools/DealerList.vue';
import {queryFrozenAmountDetail} from "@/api/omFinance/RebateManage/RebatePoolQuery";
export default {
  props: ['jfId'],
  mixins: [dictionary],
  components: {
    DealerList,
    SelectClaim,
    editForm
  },
  data() {
    return {
      rowData: null,
      visibleEdit: false,
      claimNo: null,
      dealerList: [],
      dealerCompanyCode: [],
      dealerData: [],
      selectDealerData: [],
      expressHidden: true,
      onSitePickUp: true,
      loading: false,
      dataList: [],
      dataList1: [],
      visible: false,
      selectDelearFlag: false,
      selectClaim: false,
      dialogTitle: '选择服务中心',
      //上报信息
      columns: this.creatHeader(),
      //操作记录
      caozuojilucolumns: this.caozuojilu(),
      auditInfoColumns: this.createAuditInfoColumns(),
      fetchParams: {}, //ipa 接口
      selectedRows: [], //选中服务站
      //通知单信息
      formList1: this.createFormList(),
      saveData: null,
      saveData2: null,
      editData: {},
      ownerCode: null,
      whName: null,
      whId: null,
    };
  },
  async created() {
    this.loading = true;
    await this.chuqi();
    await this.chuqi2();
    // await this.chuqi3();
    // await this.chuqi4();
    await this.init(this.jfId);
    this.loading = false;
  },
  methods: {
    // checkCertificateNo(val) {
    //   if(this.checkCode(val)) {
    //     var date = val.substring(6,14);
    //     if(this.checkCertificateNoDate(date)) {
    //       if(this.checkCertificateNoProv(val.substring(0,2))) {
    //         return true;
    //       }
    //     }
    //   }
    //   return false;
    // },
    // checkCertificateNoProv(val) {
    //   var pattern = /^[1-9][0-9]/;
    //   var provs = {11: '北京', 12: '天津', 13: '河北', 14: '山西', 15: '内蒙古',21:'辽宁', 22:'吉林', 23:'黑龙江',31:'上海',32:'江苏',33:'浙江',34:'安徽',35:'福建',36:'江西',37:'山东',41:'河南',42:'湖北 ',43:'湖南',44:'广东',45:'广西',46:'海南',50:'重庆',51:'四川',52:'贵州',53:'云南',54:'*** ',61:'陕西',62:'甘肃',63:'青海',64:'宁夏',65:'***',71:'***',81:'***',82:'澳门'};
    //   if(pattern.test(val)) {
    //     if(provs[val]) {
    //       return true;
    //     }
    //   }
    //   return false;
    // },
    // checkCertificateNoDate(val) {
    //   var pattern = /^(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)$/;
    //   if(pattern.test(val)) {
    //     var year = val.substring(0, 4);
    //     var month = val.substring(4, 6);
    //     var date = val.substring(6, 8);
    //     var date2 = new Date(year+"-"+month+"-"+date);
    //     if(date2 && date2.getMonth() == (parseInt(month) - 1)) {
    //       return true;
    //     }
    //   }
    //   return false;
    // },
    // checkCode(val) {
    //   var p = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/;
    //   var factor = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
    //   var parity = [ 1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2 ];
    //   var code = val.substring(17);
    //   if(p.test(val)) {
    //     var sum = 0;
    //     for(var i=0;i<17;i++) {
    //       sum += val[i]*factor[i];
    //     }
    //     if(parity[sum % 11] == code.toUpperCase()) {
    //       return true;
    //     }
    //   }
    //   return false;
    // },
    editclose() {
      this.visibleEdit = false;
      // this.selectClaim = true;
    },
    editsave(val) {
      this.rowData = val;
      this.visibleEdit = true;
      // this.closeDialog();
    },
    edit(val) {
      this.rowData = val;
      this.visibleEdit = true;
    },
    pickUpMethodChange (pickUpMethod){
      if (pickUpMethod == 55211005) {
        this.formList1.find(x => x.fieldName == 'pickUpMethod').initialValue = 55211005;
        this.formList1.find(x => x.fieldName == 'conTel').hidden = false;
        this.formList1.find(x => x.fieldName == 'conPerson').hidden = false;
        this.formList1.find(x => x.fieldName == 'whCode').hidden = false;
        this.formList1.find(x => x.fieldName == 'conAddress').hidden = false;
        this.formList1.find(x => x.fieldName == 'pickUpPerson').hidden = true;
        this.formList1.find(x => x.fieldName == 'certificateNo').hidden = true;
      } else {
        this.formList1.find(x => x.fieldName == 'pickUpMethod').initialValue = 55211004;
        this.formList1.find(x => x.fieldName == 'conTel').hidden = true;
        this.formList1.find(x => x.fieldName == 'conPerson').hidden = true;
        this.formList1.find(x => x.fieldName == 'whCode').hidden = true;
        this.formList1.find(x => x.fieldName == 'conAddress').hidden = true;
        this.formList1.find(x => x.fieldName == 'pickUpPerson').hidden = false;
        this.formList1.find(x => x.fieldName == 'certificateNo').hidden = false;
      }
    },
    async changeWhSelect(val) {
      console.log("传参",val)
      const res = await getListByExampleWhere({whCode : val});
      res.data.find(x => {
        if (x.whCode === val) {
          this.whId = x.whId;
          this.whName = x.whName;
          this.formList1.find(x => x.fieldName == 'conAddress').initialValue = x.whAddress;
          this.formList1.find(x => x.fieldName == 'conPerson').initialValue = x.cPerson;
          this.formList1.find(x => x.fieldName == 'conTel').initialValue = x.cTel;
          console.log(res.data)
        }
      })
    },
    //关闭
    Delearclose() {
      this.selectDelearFlag = false;
    },
    claimClose() {
      this.selectClaim = false;
    },
    async claimSave(val) {
      console.log(val)
      if (!val) {
        this.$notify.warning({ title: '提示信息', message: '请选择索赔单' });
        return;
      }
      if (this.dataList && this.dataList.length > 0) {
        if (val[0].claimNo == this.dataList[0].claimNo) {
          this.$notify.warning({ title: '提示信息', message: '已添加过该索赔单内的旧件' });
          this.selectClaim = false;
          return;
        }
        this.$notify.warning({ title: '提示信息', message: '一张紧急回运单只能对应一个索赔单' });
        return;
      }
      if (val && val[0] && val[0].claimId) {
        let res = await getPartListByClaimId({ claimId: val[0].claimId});
        if (res.data) {
          this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(res.data);
          this.selectClaim = false;
        } else {
          this.$notify.info({ title: '提示信息', message: '未查询到需要返件的旧件' });
        }
      }
    },
    claimSelect() {
      if (!this.formList1.find(x => x.fieldName == 'showOwnerCode').initialValue) {
        this.$notify.error({ title: '提示信息', message: '请选择服务站!' });
        return;
      }
      this.selectClaim = true;
    },
    //保存
    Delearsave(val) {
      console.log(val)
      this.dealerData = val;
      this.selectDealerData = [];
      // this.dealer = {...val[0]};
      // this.ownerCode = val[0].dealerCompanyCode;
      let ownerCodeArr = [];
      let dealerNameArr = [];
      let showOwnerCodeArr = [];
      val.forEach(item => {
        showOwnerCodeArr.push(item.dealerCode);
        ownerCodeArr.push(item.dealerCompanyCode);
        this.selectDealerData.push(item.dealerCompanyCode);
        // ownerCodeArr.push(item.dealerCode);
        dealerNameArr.push(item.dealerName);
      });
      // this.topFilterInit.find(x => x.fieldName == 'showOwnerCode').initialValue = dealerNameArr.join(",");
      if (ownerCodeArr.length > 0) {
        this.fetchParams.ownerCode = ownerCodeArr.join(",");
        console.log("ownerCode", this.fetchParams.ownerCode)
      }
      this.ownerCode = ownerCodeArr[0];
      this.formList1.find(x => x.fieldName == 'showOwnerCode').initialValue = showOwnerCodeArr[0];
      // this.ownerCode = "8020430"
      this.selectDelearFlag = false;
    },
    async init(val) {
      let newVar = await selectDetail({id: val});
      this.editData = newVar.data;
      console.log("=== 通过ID查询结果返回 ==== ",newVar," ======");
      this.formList1.forEach(x => {
        console.log(newVar);
        x.initialValue = newVar.data[x.fieldName];
      });
      this.auditInfoColumns.forEach(x => {
        console.log(newVar);
        x.initialValue = newVar.data[x.fieldName];
      });
      if (this.editData.pickUpMethod == 55211005) {
        this.formList1.find(x => x.fieldName == 'pickUpMethod').initialValue = 55211005;
        this.formList1.find(x => x.fieldName == 'conTel').hidden = false;
        this.formList1.find(x => x.fieldName == 'conPerson').hidden = false;
        // this.formList1.find(x => x.fieldName == 'whCode').hidden = false;
        this.formList1.find(x => x.fieldName == 'conAddress').hidden = false;
        this.formList1.find(x => x.fieldName == 'pickUpPerson').hidden = true;
        this.formList1.find(x => x.fieldName == 'certificateNo').hidden = true;
      } else {
        this.formList1.find(x => x.fieldName == 'pickUpMethod').initialValue = 55211004;
        this.formList1.find(x => x.fieldName == 'conTel').hidden = true;
        this.formList1.find(x => x.fieldName == 'conPerson').hidden = true;
        // this.formList1.find(x => x.fieldName == 'whCode').hidden = true;
        this.formList1.find(x => x.fieldName == 'conAddress').hidden = true;
        this.formList1.find(x => x.fieldName == 'pickUpPerson').hidden = false;
        this.formList1.find(x => x.fieldName == 'certificateNo').hidden = false;
      }

      //文件地址转换
      // let tempFileArr =[];
      // for (let i = 0; i < newVar.data.fileList.length; i++) {
      //   let current = newVar.data.fileList[i];
      //   let res = await findFileByUrl(current.fileUrl);
      //   if (res) {
      //     current.fileUrl = res.data;
      //     tempFileArr.push(current);
      //   }
      // }
      // this.formList2.forEach(x => {
      //   x.initialValue = newVar.data[x.fieldName];
      //   if (x.fieldName == 'fileList') {
      //     x.initialValue = newVar.data.fileList.map((f) => ({name: f.title, url: f.fileUrl}));
      //   }
      // });
      // for(let i in newVar.data.dtlList){
      //   newVar.data.dtlList[i].partStatus=newVar.data.dtlList[i].partStatus==null?55221001:newVar.data.dtlList[i].partStatus;
      //   if(!newVar.data.dtlList[i].inCount){
      //     newVar.data.dtlList[i].inCount =  newVar.data.dtlList[i].partCount
      //   }
      // }
      this.$refs.table1.$refs.pageTable.EXECUTE_INSERT(newVar.data.dtlList);
      this.$refs.table2.$refs.pageTable.EXECUTE_INSERT(newVar.data.logList);

      // if(this.rowData.statusStr ==='已回运'){
      //   this.formList1.find(x => x.fieldName == 'str').hidden = false;
      //   this.formList1.find(x => x.fieldName == 'str').initialValue = this.rowData.statusStr;
      // }else{
      //   this.formList1.find(x => x.fieldName == 'str').hidden = true;
      //   this.formList1.find(x => x.fieldName == 'returnStatus').hidden = false;
      // }
    },
    //取件方式
    async chuqi() {
      console.log("===== 获取下拉框数据 ====== ")
      const res = await getPartType({ type: 5521 });
      console.log("==========",res)
      if (res.resultCode == 200) {
        res.data = res.data.filter(x => x.codeId == 55211004 || x.codeId == 55211005)
        this.formList1.find(x => x.fieldName == 'pickUpMethod').initialValue = '';
        this.formList1.find(x => x.fieldName == 'pickUpMethod').itemList = res.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      }
    },
    //旧件仓库下拉框
    async chuqi2() {
      console.log("===== 获取下拉框数据 ====== ")
      const res = await getByPermissionCtrl();
      console.log("==========",res)
      if (res.resultCode == 200 && res.data) {
        this.formList1.find(x => x.fieldName == 'whCode').itemList = res.data.map(y => ({ text: y.whName, value: y.whCode }));
      }
    },
    //单据状态
    async chuqi3() {
      console.log("===== 获取下拉框数据 ====== ")
      const res = await getPartType({ type: 5588 });
      console.log("==========",res)
      if (res.resultCode == 200) {
        this.formList1.find(x => x.fieldName == 'returnStatus').initialValue = '';
        this.formList1.find(x => x.fieldName == 'returnStatus').itemList = res.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      }
    },
    //入库说明
    async chuqi4() {
      console.log("===== 获取下拉框数据 ====== ")
      const res = await getPartType({ type: 5590 });
      console.log("==========",res)
      if (res.resultCode == 200) {
        this.columns.find(x => x.dataIndex == 'inInfo').initialValue = '';
        this.columns.find(x => x.dataIndex == 'inInfo').editItems = res.data.map(y => ({ text: y.codeCnDesc, value: y.codeId }));
      }
    },
    formChangeHandle(val) {
      console.log(val);
      this.saveData = val;
    },
    formChangeHandle2(val) {
      console.log(val);
      this.saveData2 = val;
    },
    //搜索获取数据
    changeHandle(val) {
      this.fetchParams = val;
      console.log(val);
    },
    //选中
    selectChange(rows) {
      this.selectedRows = rows;
      console.log(this.selectedRows);
    },
    //保存
    async save() {
      this.$refs.formPanel1.SUBMIT_FORM();
      console.log(this.saveData);
      console.log(this.dataList);
      if (!this.dataList || this.dataList.length == 0) {
        this.$notify.error({ title: '提示信息', message: '紧急返件列表不能为空' });
        return;
      }

      let bool = false;
      this.dataList.forEach(x => {
        if (bool) {
          return;
        }
        if (x.isMain == "是" && (x.jfPartCount == 0)) {
          this.$notify.error({ title: '提示信息', message: '主因件返件数量不能为0' });
          bool = true;
          return;
        }
        if (!x.jfPartCount) {
          this.$notify.error({ title: '提示信息', message: '返件数量不能为空' });
          bool = true;
          return;
        }
        if (x.jfPartCount > x.partCount) {
          this.$notify.error({ title: '提示信息', message: '紧急返件数量不能大于旧件数量' });
          bool = true;
          return;
        }
      })
      if (bool) {
        return;
      }
      if (this.saveData.pickUpMethod && this.saveData.pickUpMethod == 55211004) {
        if (this.saveData.certificateNo && !checkCertificateNo(this.saveData.certificateNo)) {
          this.$notify.error({ title: '提示信息', message: '请输入正确的身份证号' });
          return;
        }
      }

      let save = Object.assign({}, this.saveData, {dtlList: this.dataList},
        {jfStatus: 55671001},
        {ownerCode: this.ownerCode},
        {whName: this.whName}
      );
      this.loading = true;
      let res = await jfSaveAdd(save);
      if (res.resultCode === 200) {
        this.loading = false;
        this.$notify.success({ title: '提示信息', message: '保存成功!' });
        this.$emit('save');
      } else {
        this.loading = false;
        this.$notify.error({ title: '提示信息', message: res.errMsg || '保存失败!' });
        // this.closeDialog();
      }
    },
    //入库
    async warehousing() {
      //因为只能修改一个表格，所以只覆盖一个表格数数据
      console.log("旧件",this.dataList);


      let bool = true;
      let bool2 = true;
      let bool3 = true;

      let tableList = this.$refs.table1.$refs.pageTable.list;
      tableList.map((x) => {
        if (x.inCount > 0 && x.inCount != null) {
          console.log("1大于0 ::" + x.inCount);
          console.log("2大于0::"+bool);
        }else {
          bool = false;
          console.log("2大于0::"+bool);

        }
        console.log("bool"+bool);
        if (x.partStatus != "") {
          bool3 = true;
        } else {
          bool3 = false;
        }
      });
      tableList.map((x) => {
        if (x.inCount <= x.partCount) {
          console.log("3入库数量::" + x.inCount + "数量::" + x.partCount);
          console.log("4大于数量::"+bool2);
        }else {
          bool2 = false;
          console.log("4大于数量::"+bool2);

        }
        console.log("bool2"+bool2);
      });

      if (this.dataList !== null) {
        if (bool) {
          if (bool2) {
            if (bool3) {

              let save = {};
              save.dtlList = this.dataList;
              save.returnStatus = 55881003;
              for (let i = 0; i < save.dtlList.length; i++) {
                if (save.dtlList[i]) {
                  if (!save.dtlList[i].inInfo || save.dtlList[i].inInfo === "") {
                    console.log(save.dtlList[i])
                    this.$notify({
                      title: '警告',
                      message: '请选择入库说明!',
                      type: 'warning',
                    });
                    this.loading = false;
                    return;
                  }
                }
              }
              for (let a in this.editData) {
                if (save[a]) {
                  this.editData[a] = save[a];
                }
              }
              this.loading = true;
              let res = await editSave(this.editData);

              console.log(res);
              if (res.resultCode === 200) {
                this.$emit('save');
                return this.$notify.success({title: '提示信息', message: '入库成功'});
              } else {
                this.loading = false;
                this.$notify.error({title: '提示信息', message: res.errMsg || '入库失败!'});
                // this.closeDialog();
              }
              this.loading = false;
            } else {
              return this.$notify.warning({ title: '提示信息', message: '旧件状态不能为空' });
            }
          } else {
            return this.$notify.warning({ title: '提示信息', message: '入库数量不能多于备件数量' });
          }
        }else {
          return this.$notify.warning({ title: '提示信息', message: '未填写入库数量' });
        }
      } else {
        return this.$notify.warning({ title: '提示信息', message: '有未校验通过的信息' });
      }
    },
    //取消操作
    closeDialog() {
      this.$emit('close', { visible: false, data: this.selectedRows, type: 'close' });
    },
    //服务站选择页面
    SelectDelear() {
      this.selectDelearFlag = true;
    },
    chooseOrderNo() {
      this.visible = true;
    },
    add() {},
    //通知单信息
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '紧急返件单号',
          fieldName: 'jfCode',
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '服务中心简称',
          fieldName: 'dealerName',
          disabled: true, // 置会
          readonly: true, // 只读
          // render: (p) => {
          //   return (
          //     <div>
          //       <el-select v-model={this.selectDealerData} disabled={true} multiple placeholder="请选择">
          //         {this.dealerData.map((item) => (
          //           <el-option key={item.dealerCode} label={item.dealerShortname} value={item.dealerCompanyCode}/>
          //         ))}
          //       </el-select>
          //       <multiuse-button style="position: absolute;right: 0;height:100%" icon="el-icon-search"
          //                        onClick={() => this.selectDelearFlag = true}/>
          //     </div>
          //   );
          // },
          // rules: [{required: true, message: '请选择服务站', trigger: 'change'}],
        },
        {
          type: 'INPUT',
          label: '服务中心代码',
          fieldName: 'showOwnerCode',
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'SELECT',
          label: '取件方式',
          fieldName: 'pickUpMethod',
          initialValue: '',
          itemList: [],
          // rules: [{required: true, message: '请选择取件方式', trigger: 'change'}],
          // change: val => {
          //   this.pickUpMethodChange(val);
          // },
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'SELECT',
          label: '收件仓库',
          fieldName: 'whCode',
          initialValue: '',
          itemList: [],
          // rules: [{required: true, message: '请选择收件仓库', trigger: 'change'}],
          // hidden: true,
          change: val => {
            this.changeWhSelect(val);
          },
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'SELECT',
          label: '是否整单回运',
          fieldName: 'wholeReturn',
          initialValue: '',
          itemList: this.createDictList('1004'),
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '取件人',
          fieldName: 'pickUpPerson',
          // rules: [{required: true, message: '请输入取件人', trigger: 'change'}],
          hidden: true,
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '取件人身份证',
          fieldName: 'certificateNo',
          // rules: [{required: true, message: '请输入取件人身份证号码', trigger: 'change'}],
          hidden: true,
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '收件人',
          fieldName: 'conPerson',
          // rules: [{required: true, message: '请输入收件人', trigger: 'change'}],
          hidden: true,
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '收件人电话',
          fieldName: 'conTel',
          // rules: [{required: true, message: '请输入收件人电话', trigger: 'change'}],
          hidden: true,
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'INPUT',
          label: '收件地址',
          fieldName: 'conAddress',
          // rules: [{required: true, message: '请输入收件人电话', trigger: 'change'}],
          selfCols: 3,
          hidden: true,
          disabled: true, // 置会
          readonly: true // 只读
        },
        {
          type: 'TEXT_AREA',
          label: '紧急返件理由',
          fieldName: 'jfReason',
          maxlength: 200,
          selfCols: 3,
          // rules: [{required: true, message: '请输入紧急返件理由', trigger: 'change'}],
          disabled: true, // 置会
          readonly: true // 只读
          // rows: 3
        },
      ];
    },
    //旧件列表
    creatHeader() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {title: '是否主因件', dataIndex: 'isMain', sorter: true},
        { title: '索赔单号',
          dataIndex: 'claimNo',
          sorter: true,
          render: props => {
            return (
              <div style='text-align:center'>
                <multiuse-button size='mini' type='text' onClick={() => this.editsave(props.row)}>
                  {props.row.claimNo}
                </multiuse-button>
              </div>
            );
          }
        },
        {title: 'VIN', dataIndex: 'vin', sorter: true, width: 150},
        {title: '车型名称', dataIndex: 'modelName', sorter: true},
        {title: '索赔类型', dataIndex: 'cmsClaimTypeStr', sorter: true},
        {title: '旧件代码', dataIndex: 'partCode', sorter: true},
        {title: '旧件名称', dataIndex: 'partName', sorter: true},
        {title: '采购渠道编码', dataIndex: 'channelCode', sorter: true},
        {title: '旧件数量', dataIndex: 'partCount', sorter: true},
        {
          title: '紧急返件数量',
          dataIndex: 'jfPartCount',
          sorter: true,
          minWidth: 120,
          showOverflowTooltip: true,
          precision: 0,
          editType: 'number',
          placeholder: '请填写紧急返件数量...',
          rules: [{required: true, message: '请填写紧急返件数量...', trigger: 'blur'}]
        },
      ];
    },
    createAuditInfoColumns() {
      return [
        {
          type: 'TEXT_AREA',
          label: '审核说明',
          selfCols: 3,
          rows: 3,
          fieldName: 'auditRemark',
          placeholder: '审核说明',
          initialValue: '',
          maxlength: 300,
          disabled: true, // 置会
          readonly: true // 只读
        }
      ];
    },
    //操作记录
    caozuojilu() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {title: '操作人', dataIndex: 'checkByStr', sorter: true},
        {title: '操作状态', dataIndex: 'checkStatusStr', sorter: true},
        {title: '操作时间', dataIndex: 'checkAt', dateFormat:'yyyy-MM-dd', sorter: true},
        {title: '操作说明', dataIndex: 'checkRemarks', sorter: true}
      ];
    }
  }
};
</script>
<style lang="less" scoped></style>
